package com.example.back_code.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.back_code.entity.po.StudentTeacherRel;
import com.example.back_code.mapper.StudentTeacherRelMapper;
import com.example.back_code.service.StudentTeacherRelService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class StudentTeacherRelServiceImpl extends ServiceImpl<StudentTeacherRelMapper, StudentTeacherRel> implements StudentTeacherRelService {
    @Override
    public List<Long> getStudentIdsByTeacherId(Long teacherId) {
        QueryWrapper<StudentTeacherRel> wrapper = new QueryWrapper<>();
        wrapper.eq("teacher_id", teacherId);
        return this.list(wrapper).stream().map(StudentTeacherRel::getStudentId).collect(Collectors.toList());
    }
} 